package v1

import (
	"github.com/gin-gonic/gin"
	"guns-go/model/request"
	"guns-go/model/response"
	"guns-go/service"
)

// @Tags VisitLog
// @Summary 访问日志列表查询
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.SysVisLogParam true "请求参数"
// @Success 200 {string} string "{"success":true,"data":{},"message":"请求成功","code":200}"
// @Router /sysVisLog/page [get]
func SysVisitLogPage(c *gin.Context) {

	var V request.SysVisLogParam
	_ = c.ShouldBindQuery(&V)

	err, OrgPageResult := service.SysVisitLogPage(&V, c)

	if err != nil {
		response.FailWithMessage(err.Error(), c)
		return
	}
	response.OkWithData(OrgPageResult, c)
}

// @Tags VisitLog
// @Summary 访问日志清除
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.SysVisLogParam true "请求参数"
// @Success 200 {string} string "{"success":true,"data":{},"message":"请求成功","code":200}"
// @Router /sysVisLog/delete [post]
func SysVisitLogDelete(c *gin.Context) {

	err := service.DeleteSysVisitLog()

	if err != nil {
		response.FailWithMessage(err.Error(), c)
		return
	}
	response.Ok(c)
}
